<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .test{
      color: red;
    }
    .green {
      color: green;
    }
    .active{ 
      color: pink;
    }
    .danger{
      border: 1px solid red;
    }
  </style>
</head>
<body>
  <!-- class 对象绑定 -->
  <div id="app">
    <div class="test">测试内容 红色</div>
    <div v-bind:class="test">测试内容 绿色</div>

    <div :class="{ active: flag, danger: one, primary: two }">对象绑定</div>
    <button @click="flag = !flag">按钮</button>
  </div>

  <script src="./vue.js"></script>
  <script>
    // vue发现 我们通常也是需要去频繁绑定样式操作的，所以专门做了增强, v-bind 可以给 class和 style 绑定 数组 或对象.
    const vm = new Vue({
      el: '#app', 
      data: {
        test: 'green',
        flag: true,
        one: true,
        two: true
      },
      methods: {

      }
    })

  </script>
</body>
</html>